package com.xgzit.xgzmall.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.xgzit.common.dto.mq.SeckillOrderDto;
import com.xgzit.common.utils.PageUtils;
import com.xgzit.xgzmall.order.entity.OrderEntity;
import com.xgzit.xgzmall.order.vo.*;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author xgz
 * @email 923904706@qq.com
 * @date 2021-03-20 17:29:23
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /** 订单确认页返回需要的数据 **/
    OrderConfirmVo confirmOrder() throws ExecutionException, InterruptedException;

    /** 下单 **/
    SubmitOrderResponseVo submitOrder(OrderSubmitVo vo);

    /** 通过订单Sn获取订单信息 **/
    OrderEntity getOrderByOrderSn(String orderSn);

    /** 关闭订单 **/
    void closeOrder(OrderEntity entity);

    /**
     * 获取需要支付的信息
     * @param orderSn:
     * @return com.xgzit.xgzmall.order.vo.PayVo
     **/
    PayVo getOrderPay(String orderSn);

    /**
     * 查出当前用户的所有订单数据
     * @param params:
     * @return com.xgzit.common.utils.PageUtils
     **/
    PageUtils queryPageWithItem(Map<String, Object> params);

    /**
     * 处理支付宝付款是否成功
     * @param vo:
     * @return java.lang.String
     **/
    String handlePayResult(PayAsyncVo vo);

    /**
     * 修改订单状态
     *
     * @param orderSn:
     * @param code:
     * @return void
     **/
    void updateOrderStatus(String orderSn, Integer code);

    /**
     * 创建秒杀单
     * @param orderDto:
     * @return void
     **/
    void createSeckillOrder(SeckillOrderDto orderDto);
}

